# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html

import scrapy


class RecruitItem(scrapy.Item):
    # define the fields for your item here like:
    # name = scrapy.Field()
    pass
# 智联招聘
class ZhiLianItem(scrapy.Item):
    name = scrapy.Field()
    title = scrapy.Field()
    salary = scrapy.Field()
    company = scrapy.Field()
    addr = scrapy.Field()
    experience = scrapy.Field()
    Education = scrapy.Field()
    desc = scrapy.Field()
    this_url = scrapy.Field()
    # 定义存入数据库的函数
    def get_insert_sql(self):
        insert_sql = 'INSERT INTO recruit(`name`,title,salary,company,addr,experience,Education,`desc`,this_url) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s)'
        data = (self['name'],self['title'],self['salary'],self['company'],self['addr'],self['experience'],self['Education'],self['desc'],self['this_url'])
        return (insert_sql,data)
# 前程无忧
class QianChengItem(scrapy.Item):
    name = scrapy.Field()
    title = scrapy.Field()
    salary = scrapy.Field()
    company = scrapy.Field()
    addr = scrapy.Field()
    experience = scrapy.Field()
    Education = scrapy.Field()
    time = scrapy.Field()
    new_desc = scrapy.Field()
    this_url = scrapy.Field()
    def get_insert_sql(self):
        insert_sql = 'INSERT INTO recruit(`name`,title,salary,company,addr,experience,Education,`time`,`desc`,this_url) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'
        data = (self['name'],self['title'],self['salary'],self['company'],self['addr'],self['experience'],self['Education'],self['time'],self['new_desc'],self['this_url'])
        return (insert_sql,data)

# 拉勾网
class LiePingItem(scrapy.Item):
    name = scrapy.Field()
    title = scrapy.Field()
    salary = scrapy.Field()
    company = scrapy.Field()
    addr = scrapy.Field()
    experience = scrapy.Field()
    Education = scrapy.Field()
    time = scrapy.Field()
    new_desc = scrapy.Field()
    this_url = scrapy.Field()
    def get_insert_sql(self):
        insert_sql = 'INSERT INTO recruit(`name`,title,salary,company,addr,experience,Education,`time`,`desc`,this_url) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'
        data = (self['name'],self['title'],self['salary'],self['company'],self['addr'],self['experience'],self['Education'],self['time'],self['new_desc'],self['this_url'])
        return (insert_sql,data)